package com.sensetime.bi.senselink.server.rtsp.session;

import org.apache.commons.lang3.RandomStringUtils;

public class SimpleRandomIdFactory implements RtspSessionIdFactory {

  private static final int HEADER_COUNT = 8;
  private static final int FOOTER_COUNT = 10;
  private static final String DELIMITER = "-";

  @Override
  public synchronized String createSessionId() {
    String header = RandomStringUtils.randomNumeric(HEADER_COUNT);
    String footer = RandomStringUtils.randomNumeric(FOOTER_COUNT);
    return header + DELIMITER + footer;
  }

  public static void main(String[] args) {
    SimpleRandomIdFactory srf = new SimpleRandomIdFactory();
    System.out.println(srf.createSessionId());
  }

}
